package com.smt.modules.app.controller;

import java.util.Arrays;
import java.util.Map;

import com.smt.modules.app.annotation.Login;
import com.smt.modules.app.annotation.LoginUser;
import com.smt.modules.bus.entity.MemberUserEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import com.smt.common.base.BaseController;
import com.smt.modules.bus.vo.ConsumptionFileVo;
import com.smt.modules.bus.entity.ConsumptionFileEntity;
import com.smt.modules.bus.service.ConsumptionFileService;
import com.smt.common.utils.PageUtils;
import com.smt.common.utils.R;



/**
 * 消费文件表
 *
 * @author murong
 * @email 981620741@qq.com
 * @date 2018-10-17 10:06:53
 */
@RestController
@RequestMapping("app/consumptionfile")
@Api(tags = {"AppConsumptionFileController"},description = "消费文件表")
public class AppConsumptionFileController extends BaseController{
    @Autowired
    private ConsumptionFileService consumptionFileService;

    /**
    * 查询消费文件列表
     *
    * @return
    */
    @GetMapping("/list")
    @ApiOperation(value = "消费文件列表")
    public R list(){
        return consumptionFileService.list();
    }


    /**
     * 获取文件详细信息
     */
    @Login
    @GetMapping("/info/{id}")
    @ApiOperation(value  = "获取文件详细信息")
    public R info(@PathVariable("id") Long id, @LoginUser MemberUserEntity memberUserEntity){
        return consumptionFileService.info(id,memberUserEntity);
    }

    /**
     * 搜索文件
     */
    @GetMapping("/searchFileName/{name}")
    @ApiOperation(value  = "搜索文件")
    public R searchFileName(@PathVariable("name") String name){
        return consumptionFileService.searchFileName(name);
    }
}
